class Solution:
    def rotateTheBox(self, box: list) -> list:
        newBox = [["." for _ in range(len(box))]for _ in range(len(box[0]))]
        for i in range(len(box)):
            end = len(box[i])-1
            for j in range(len(box[i])-1, -1, -1):
                if box[i][j] == '#':
                    newBox[end][len(box)-i-1] = '#'
                    end -= 1
                elif box[i][j] == '*':
                    newBox[j][len(box)-i-1] = "*"
                    end = j-1

        return newBox
